package com.spzx.common.core.feign.Interceptor;

import com.spzx.common.core.constant.SecurityConstants;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

@Component
public class ProductFeignInterceptor implements RequestInterceptor {
/*
openfeign 的拦截器  远程调用 内部借口 需要配置统一的头
可以在远程调用之前，对请求报文进行处理
 */

    @Override
    public void apply(RequestTemplate requestTemplate) {
        //添加请求头
        requestTemplate.header(SecurityConstants.FROM_SOURCE,SecurityConstants.INNER);
    }
}
